home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
graph-3d.zip
/
GRAPH05.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-04-23
|
1KB
|
40 lines
0 dim a(32):key off:screen 2
40 cls:locate 10,30:input "Line density (MAX=8)";ld$:ld=val(ld$):if ld=0 then ld=4
55 locate 12,33:input "Dot density";dd$:dd=val(DD$):if dd=0 then dd=32
65 locate 14,30:print"Seclect Viewing Angle":print tab(30)" 0 degrees is from overheard":print tab(30)" 90 degrees is from the side"
66 locate 18,30:input "Angle in degrees";a$:a=val(a$):if a=0 then a=75
90 a=a*3.14159/180:s=sin(a):c=cos(a):cls
110 for i=-4*dd to 0
115 max=-100:min=100:x=i/dd:x1=int(30*x+.5)
120 nl=4*ld
125 for k=-nl to 0
130 y=k/ld
135 gosub 1000
140 a(-k)=z
145 gosub 2000
150 next k
155 gosub 3000
160 next i
175 sound 1000,2:t=timer:while t+1.5>timer:wend
185 if inkey$="" then 175
190 locate 25,1:print"Press <R>epeat or <E>xit";
195 a$=inkey$:if a$="R" or A$="r" then 40 else if a$<>"E" and a$<>"e" then 195
200 end
1000 r=sqr(x*x+y*y)
1010 z=2*exp(-r)*cos(3*r)
1020 return
2000 y=int(30*(c*y+s*z)+.5)
2010 if y<min then min=y else 2050
2030 pset(320+x1,100-y)
2040 pset(320-x1,100-y)
2050 if y>max then max=y else return
2060 pset(320+x1,100-y)
2070 pset(320-x1,100-y)
2090 return
3000 for k=0 to nl
3010 z=a(k)
3020 y=k/ld
3040 gosub 2000
3050 next k
3060 return